from launch import LaunchDescription
from launch.actions import LogInfo
from launch_ros.actions import Node
#封装终端指令相关类--------------
#from launch.actions import ExecuteProcess
#from launch.substitutions import FindExecutable
#参数声明与获取-----------------
#from launch.actions import DeclareLaunchArgument
#from launch.substitutions import LaunchConfiguration
#文件包含相关-------------------
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
#分组相关----------------------
#from launch_ros.actions import PushRosNamespace
#from launch.actions import GroupAction
#事件相关----------------------
#from launch.event_handlers import OnProcessStart,OnProcessExit
#from launch.actions import ExecuteProcess,RegisterEventHandler,LogInfo
#获取功能包下share目录路径-------
from ament_index_python.packages import get_package_share_directory
import os

def generate_launch_description():
    include=IncludeLaunchDescription(              #用来查找源文件
        launch_description_source=PythonLaunchDescriptionSource(      #用来把源文件封装成一个变量
            launch_file_path=os.path.join(get_package_share_directory("cpp_launch"),"launch/py/py04_args_launch.py")
        ),
        launch_arguments=[("backg_r","0")]#也可以在命令行改 backg_r:=100,
    )
    loginfo=LogInfo(msg=str(include))

    return LaunchDescription([include,loginfo])